<?php
namespace Application\Repository;
use Doctrine\ORM\EntityRepository;

class QueuePublicationRepository extends AbstractRepository
{
    protected $table="queue_publication";
    
    
    public function getByMedia($mediaId,$number = 30)
    {
    	$dql = "SELECT c FROM $this->table c WHERE c.media_id=?1";
    
    	return $this->getEntityManager()->createQuery($dql)
    	->setParameter(1, $mediaId)
    	->setMaxResults($number)
    	->getResult();
    }
    
    public function getByMediaCompetition($mediaCompetitionId,$number = 30)
    {
    	$dql = "SELECT c FROM $this->table c WHERE c.media_competition_id=?1";
    
    	return $this->getEntityManager()->createQuery($dql)
    	->setParameter(1, $mediaCompetitionId)
    	->setMaxResults($number)
    	->getResult();
    }
    
}